package com.wykj.business.entity;

import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 2017/4/29.
 */
public class ResultMap extends HashMap {

    private static final String DATA = "entity";
    private static final String LIST = "list";
    private static final String MSG = "msg";
    private static final String STATE = "state";


    public void setList(List<?> object){
        this.put(LIST,object);
    }
    public void setData(Object object){
        this.put(DATA,object);
    }
    public void setMsg(String object){
        this.put(MSG,object);
    }
    public void setState(Boolean b){
        if(b == true){
            this.put(STATE,Constants.SUCCESS_CODE);
            this.setMsg("操作成功");
        }else{
            this.put(STATE,Constants.ERROR_CODE);
            this.setMsg("操作失败");
        }
    }

    public Boolean isSuccess(){
        if(this.get(STATE) !=null && this.get(STATE).equals(Constants.SUCCESS_CODE)){
            return true;
        }else{
            return false;
        }
    }

}
